//
//  AppDelegate.swift
//  CJPack
//
//  Created by 陈警卫 on 2022/11/16.
//

/**
 pod lib lint
 git tag '1.1.10'
 git push --tags
 pod repo push --sources=https://gitee.com/giteecjw0124/JwSpec.git,https://github.com/CocoaPods/Specs.git JwSpec CJPack.podspec --allow-warnings
 
 
 pod repo remove JwSpec
 pod repo add JwSpec https://gitee.com/giteecjw0124/JwSpec.git
 
 */

import UIKit
import AVFAudio

@main
class AppDelegate: UIResponder, UIApplicationDelegate, CJOrientAppDelegate {
    
    var window: UIWindow?
    var deviceOrientation: CJScreenOrient = .port
    
    // 程序启动
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
        
        window = UIWindow(frame: UIScreen.main.bounds)
        window?.makeKeyAndVisible()
        
        let audioSession = AVAudioSession.sharedInstance()
        do {
            try audioSession.setCategory(.playback)
        } catch {
            
        }
        
        handleFrontCompose()
        showRootController()
        
        return true
    }
}

extension AppDelegate {
    
    func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
        if deviceOrientation == .port {
            return .portrait
        } else if deviceOrientation == .land {
            return .landscape
        }
        return .all
    }
}


